package com.un.ebs.core.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import lombok.Getter;

@Getter
public enum SexEnum implements IEnum {
    Male(0, "男"), Female(1, "女"), Notdefine(2, "未指定");

    SexEnum(Integer value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    @EnumValue
    private final Integer value;
    private final String desc;

    @Override
    public int getCode() {
        return value;
    }

    public static SexEnum valueOf(int code) {
        switch (code) {
            case 0:
                return SexEnum.Male;
            case 1:
                return SexEnum.Female;
            case 2:
            default:
                return SexEnum.Notdefine;
        }
    }
}
